package com.send;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ImportResource;

import com.send.api.IQueue;

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@ImportResource("beans.xml")
public class SendServiceApp implements CommandLineRunner {

	@Autowired
	private IQueue iQueue;

	public static void main(String[] args) throws Exception {
		SpringApplication.run(SendServiceApp.class, args);
	}

	@Override
	public void run(String... strings) throws Exception {
		/*EmailConfig vo = new EmailConfig();
		vo.setContent("发送OK");
		iQueue.sendQueue(vo);*/
	/*	boolean isConsumerSide = RpcContext.getContext().isConsumerSide(); // 本端是否为消费端，这里会返回true
		String serverIP = RpcContext.getContext().getRemoteHost(); // 获取当前线程最后一次调用的提供方IP地址
		String application = RpcContext.getContext().getUrl().getParameter("application");// 获取当前服务配置信息(笔者注:为consumer,无法获取provider的application地址)，所有配置信息都将转换为URL的参数
		System.out.print("本端是否为消费端" + isConsumerSide);
		System.out.print("获取当前线程最后一次调用的提供方IP地址" + serverIP);
		System.out.print("获取当前服务配置信息" + application);*/
	}
}
